import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from "../views/index/Index";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Index',
        component: Index
    },
    {
        path: '/search',
        name: 'Search',
        component: () => import(/* webpackChunkName: "about" */ '../views/search/Search')
    },
    {
        path: '/category',
        name: 'Category',
        component: () => import(/* webpackChunkName: "about" */ '../views/category/Category')
    },
    {
        path: '/cart',
        name: 'Cart',
        component: () => import(/* webpackChunkName: "about" */ '../views/shopping_cart/ShoppingCart')
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import(/* webpackChunkName: "about" */ '../views/login/Login')
    },
    {
        path: '/register',
        name: 'Register',
        component: () => import(/* webpackChunkName: "about" */ '../views/register/Register')
    },
    {
        path: '/order_settle',
        name: 'orderSettle',
        component: () => import(/* webpackChunkName: "about" */ '../views/order_settle/orderSettle')
    },
    {
        path: '/order',
        name: 'Order',
        component: () => import(/* webpackChunkName: "about" */ '../views/order/Order')
    },
    {
        path: '/order_detail',
        name: 'OrderDetail',
        component: () => import(/* webpackChunkName: "about" */ '../views/order_detail/OrderDetail')
    },
    {
        path: '/pay',
        name: 'Pay',
        component: () => import(/* webpackChunkName: "about" */ '../views/pay/Pay')
    },
    {
        path: '/mine',
        name: 'Mine',
        component: () => import(/* webpackChunkName: "about" */ '../views/mine/Mine')
    },
    {
        path: '/admin/login',
        name: 'adminLogin',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/login/Login')
    },
    {
        path: '/admin/index',
        name: 'adminIndex',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/index/Index'),
        meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }
    },
    {
        path: '/admin/echarts',
        name: 'adminEcharts',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/components/Echarts'),
        meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }
    },
    {
        path: '/admin/product',
        name: 'adminProduct',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/product/Product'),
        meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }
    },
    {
        path: '/admin/category',
        name: 'adminCategory',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/category/Category'),
        meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }
    },
    {
        path: '/admin/order',
        name: 'adminOrder',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/order/Order'),
        meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }
    },
    {
        path: '/admin/order',
        name: 'adminUser',
        component: () => import(/* webpackChunkName: "about" */ '../views/admin/user/User'),
        meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})


export default router
